package com.demo.user.feign;

import com.demo.common.base.pojo.JsonRes;
import com.demo.user.service.AuthUserService;
import com.demo.user.vo.AuthUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author DayDayUp
 * create on 2023-08-15
 **/
@Slf4j
@RestController
@RequestMapping("authUser")
public class AuthUserFeignClient {
    @Resource
    private AuthUserService authUserService;

    /**
     * 根据用户名获取所有的权限按钮
     * @param username 用户名
     * @return List<String>
     */
    @GetMapping("getUserByUsername")
    public JsonRes<AuthUserVO> getUserByUsername(@RequestParam("username") String username) {
        AuthUserVO authUserVO = authUserService.getUserByUsername(username);
        return JsonRes.ok(authUserVO);
    }

}
